/*
 *  Copyright 2004 Blandware (http://www.blandware.com)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.blandware.atleap.service.core;

import com.blandware.atleap.common.util.PartialCollection;
import com.blandware.atleap.common.util.QueryInfo;
import com.blandware.atleap.model.core.ContentLocale;
import com.blandware.atleap.persistence.exception.DeleteException;
import com.blandware.atleap.service.exception.BeanAlreadyExistsException;
import com.blandware.atleap.service.exception.BeanNotFoundException;

import java.util.List;

/**
 * <p>Business Delegate (Proxy) Interface to handle communication between web and
 * persistence layer. Caches list of all available locales, active locales and default one
 * </p>
 * <p><a href="ContentLocaleManager.java.html"><i>View Source</i></a>
 * </p>
 *
 * @author Sergey Zubtsovskiy <a href="mailto:sergey.zubtsovskiy@blandware.com">&lt;sergey.zubtsovskiy@blandware.com&gt;</a>
 * @version $Revision: 1.12 $ $Date: 2007/12/11 14:23:43 $
 */
public interface ContentLocaleManager extends BaseManager {

	/**
	 * Performs initialization of manager
	 */
	public void initialize();

	//~ CRUD Methods ================================================================

	/**
	 * Creates new content locale
	 *
	 * @param contentLocale Content locale to create
	 * @throws BeanAlreadyExistsException if locale with the same identifier already exists
	 */
	public void createContentLocale(ContentLocale contentLocale) throws BeanAlreadyExistsException;

	/**
	 * Retrieves content locale with specified identifier
	 *
	 * @param localeIdentifier  identifier of locale to obtain
	 * @return Content locale or null if no content locale with specified identifier exists in database
	 */
	public ContentLocale retrieveContentLocale(String localeIdentifier);

	/**
	 * Updates content locale
	 *
	 * @param contentLocale content locale to update
	 */
	public void updateContentLocale(ContentLocale contentLocale);


	/**
	 * Removes content locale
	 *
	 * @param localeIdentifier Identifier of content locale to remove
	 * @throws DeleteException if locale cannot be deleted (e.g. one or more content field values are associated with it)
     * @throws BeanNotFoundException if no such locale already exists
	 */
	public void deleteContentLocale(String localeIdentifier) throws DeleteException, BeanNotFoundException;

	// ~ Additional methods ================================================================

	/**
	 * Retrieves filtered/sorted collection of content locales
	 *
	 * @param queryInfo Object that contains information about how to filter and sort data
	 * @return Collection of content locales
	 */
	public PartialCollection listContentLocales(QueryInfo queryInfo);

	/**
	 * Finds default content locale.
     *
	 * @return Default content locale or null if nothing was found
	 */
	public ContentLocale getDefaultLocale();

	/**
	 * Returns list of locales, available in system
     *
	 * @return All available locales
	 */
	public List getAvailableLocales();

	/**
	 * Returns list of all enabled locales.
     *
	 * @return All enabled locales
	 */
	public List getEnabledLocales();

    /**
	 * Returns list of active locales
     * 
	 * @return List of active locales
	 */
	public List getActiveLocales();

	// ~ Finders ================================================================

}
